#include "AdoConnector.h"

struct fuAdoConnector::pimpl_t {
    fuAdoConnector & m_con;
    _ConnectionPtr  m_pConnection;

    pimpl_t(fuAdoConnector & con) :
    m_con(con),
    m_pConnection("ADODB.Connection")
    {
    }

    ~pimpl_t(void){
    }

    bool Open( _bstr_t connstr, _bstr_t userid = "", _bstr_t paswd = "" )
    {
        try
        {
            if( m_con.IsOpen() )
                m_con.Close();

            m_pConnection->Open(connstr,userid,paswd,adConnectUnspecified);
            return true;
        }
        catch_com_error(fuAdoConnector::Open);

        return false;
    }

    bool Open(const CString & strcon,const CString & userid = "", const CString & passwd = ""){
        return Open((_bstr_t)strcon,(_bstr_t)userid,(_bstr_t)passwd);
    }
};
